import java.util.Scanner;

/*
 *Description:
 *User:laoHu
 *Created with Intellij IDEA 2025
 *Data:2025.06.16
 *Time:10：03
 */
public class Main{

    public static  int countSegments(String s) {
        String[] s1 = s.split(" ");
        int cnt = s1.length;
        for(int i =0;i < s1.length;i++){
            if(s1[i].equals(""))
                cnt--;
        }
        return cnt;
    }

    public static void main(String[] args) {
        System.out.println(countSegments("    a b c     "));
    }
    public boolean isLower(char ch){
        if(ch >= 'A' && ch <= 'Z') return true;
        else return false;
    }

    public String toLowerCase(String s) {
        char[] ch = s.toCharArray();
        for(int i = 0; i < s.length(); i++){
            if(isLower(s.charAt(i))){
                ch[i] = (char)(s.charAt(i) + 32);
            }
        }
        return new String(ch);
    }

    public boolean isPalindrome(String s) {

        int left = 0;
        int right = s.length() - 1;
        s = s.toLowerCase();
        while(left < right ){
            while(left < right &&!Character.isLetterOrDigit(s.charAt(left))){
                left++;
            }
            while(left < right && !Character.isLetterOrDigit(s.charAt(right))){
                    right--;
            }


                 if(s.charAt(left) != s.charAt(right)){
                     return false;
                }else{
                    left++;
                    right--;
                }
        }
        return true;
    }

    public static void main4(String[] args){

        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();

        String[] s1 = s.split(" ");

//        int cnt = 0;
//        for(int i = 0; i < s1.length ;i++ ){
//            if(!s1[i].equals(" "))
//                cnt++;
//        }
        System.out.println(s1[s1.length - 1].length());
    }

    public static  int firstUniqChar(String s) {
        int[] a = new int[26];

        for (int i = 0; i < s.length(); i++) {
            a[s.charAt(i) - 'a']++;
        }
        int i = 0;
        for (; i < s.length(); i++) {
            if (a[s.charAt(i) - 'a'] == 1){
                return i;
            }
        }

        return -1;
    }

    public static void main2(String[] args) {
       int pos = firstUniqChar("leetcode");
        System.out.println(pos);
    }


    //StringBuffer和StringBuilder的区别
    public static void main1(String[] args) {
        //单线程： public StringBuilder append(String str)
        StringBuilder stringBuilder;
        //多线程： public synchronized void setLength(int newLength)
        //被synchronized修饰的代表多线程
        StringBuffer stringBuffer;
    }
}
